#include<iostream>
#include<vector>

using namespace std;

vector<vector<int>> generateMatrix(int n)
{
    int judge = 1;
    vector<vector<int>> tmp(n, vector<int>(n, 0));
    int sum = n * n;
    int i = 0, j = 0;
    while (sum)
    {
        if (judge == 1)
        {
            while (j < n - 1 && tmp[i][j + 1] != 0)
            {
                j++;
                sum--;
            }
            judge++;
        }
        else if (judge == 2)
        {
            while (i < n - 1 && tmp[i + 1][j] != 0)
            {
                i++;
                sum--;
            }
            judge++;
        }
        else if (judge == 3)
        {
            while (j > 0 && tmp[i][j - 1] != 0)
            {
                j--;
                sum--;
            }
            judge++;
        }
        else if (judge == 4)
        {
            while (i > 0 && tmp[i - 1][j] != 0)
            {
                i--;
                sum--;
            }
            judge = 1;
        }
    }
    return tmp;
}


int main()
{
    
    return 0;
}